package ch7;

//线程1:输出信息
public class Thread3 extends Thread {
	public Thread3(int n) {
		super("线程" + n);
		if (n % 3 == 0)
			super.setPriority(Thread.MAX_PRIORITY);
		else if (n % 3 == 1)
			super.setPriority(Thread.MIN_PRIORITY);
		else
			super.setPriority(Thread.NORM_PRIORITY);
	}

	// start一般不重写
	@Override
	public void run() {
		for (int i = 1; i <= 50; i++) {
			System.out.println(super.getName() + ": 输出了 " + i);
			try {
				super.sleep(40);
			} catch (InterruptedException e) {
				// TODO 自动生成的 catch 块
				e.printStackTrace();
			}
		}

	}
}
